Query Analyzer
With the query analyzer module you can analyze and get insights about your queries without integrating Metis in your application.
The query analyzer requires only a query and its executions plan in order to provide valuable insight about it.
The query analyzer uses the same Metis engine to get comprehensive information about a given query.
Login is not required for using the Query Analyzer
How to use it
- Go to the query analyzer page - login is not required
- Paste your query in the text box on the left side of the page
- Paste the queries execution plan in the text box on the right side of the page
- Click on “Analyze”
How to create an Execution Plan
Execution plan is the instruction set for the DB on how to execute a given query, and it holds a valuable information on how the BD will behave and what the impact on the DB will be.
In order to generate an execution plan from a query, you need to run your query with the EXPLAIN command before the query.
Add the following line of code before running the query:
EXPLAIN (ANALYZE, COSTS, VERBOSE, BUFFERS, TIMING, FORMAT JSON)
For example:
EXPLAIN (ANALYZE, COSTS, VERBOSE, BUFFERS, TIMING, FORMAT JSON)
select *
from postgres_air.flight
where flight_id = 108340
The result will be an execution plan, in a JSON format which we will copy to the Query analyzer.
After inserting a query and its execution plan the Query analyzer will look like this:
After clicking on “Analyze” you will get an analyzed query result with insights